package com.five.wisdomClass.controller;

import com.five.wisdomClass.bean.ResponseData;
import com.five.wisdomClass.service.IAcademyService;
import com.five.wisdomClass.service.ILeaveService;
import com.five.wisdomClass.service.IMajorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@Tag(name="公共接口")
@Slf4j
@RestController
@CrossOrigin
@RequiredArgsConstructor
public class CommonController extends BaseController{
    @Autowired
    ILeaveService leaveService;

    @Autowired
    IAcademyService academyService;

    @Autowired
    IMajorService majorService;
    @Operation(summary = "查询当日的两种请假类型的人数")
    @GetMapping("/getleavecount")
    public ResponseData<Object> getLeaveCountByType(){
        return returnObject(leaveService.getLeaveCountByType());
    }

    @Operation(summary = "获取每个院系的人数")
    @GetMapping("/getacademystudents")
    public ResponseData<Object> getAcademyStudents(){
        return returnObject(academyService.getAcademyStudents());
    }

    @Operation(summary = "获取每个专业的人数")
    @GetMapping("/getmajorstudents")
    public ResponseData<Object> getMajorStudents(){
        return returnObject(majorService.getMajorStudents());
    }
}
